#ifndef HTTPCLIENT_H
#define HTTPCLIENT_H

#include <QObject>
#include <QFile>
#include <QUrl>
#include "links/link.h"
#include "siteParsers/SiteParser.h"
#include <QNetworkAccessManager>    
#include <QNetworkReply>    



class Link;

class HttpClient : public QObject
{
    Q_OBJECT
    QNetworkAccessManager *socket;
    SiteParser *parser;
    //QString *host;
    QFile* outFile;
    Link* link;
    QNetworkReply *rply;
    QNetworkRequest zapamietaj;
    QNetworkRequest request;
public:
    HttpClient(QObject *parent = 0);
    ~HttpClient();
    void setAddress(Link*);
    void setProxy(QNetworkProxy*);

signals:
    void wait(int, Link*);
    void finnished(Link*);
    void error(int errNo, Link*);
public slots:
    void getPage(QUrl path, QString arr="");
    void responseHeaderReceived ();
    void requestFinished(QNetworkReply*);
    void waitHandler(int);
    void errorHandler(QNetworkReply::NetworkError);
    void errorHandler(int errCode);
    void infoHandler(int errCode);
};

#endif // HTTPCLIENT_H
